feat: backend unit test part II #108
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
This pull request introduces several changes, primarily focusing on adding test coverage for various modules, refining abstract methods in the storage interface, and improving the structure of test files. Below is a summary of the most important changes grouped by theme:
Test Coverage Enhancements
auth_utils
, including scenarios for tenant ID extraction, user details initialization, and user authentication (src/tests/backend/api/auth/auth_utils_test.py
).status_updates
, covering WebSocket connection management, status update sending, and connection closure (src/tests/backend/api/status_updates_test.py
).BaseSQLAgent
,FixerAgent
,MigratorAgent
, andPickerAgent
, to validate their properties, behaviors, and response handling (src/tests/backend/sql_agents/agents/agent_base_test.py
,src/tests/backend/sql_agents/agents/fixer/fixer_agent_test.py
,src/tests/backend/sql_agents/agents/migrator/migrator_agent_test.py
,src/tests/backend/sql_agents/agents/picker/picker_agent_test.py
). [1] [2] [3] [4]FixerResponse
andMigratorResponse
, to ensure proper validation and handling of optional fields (src/tests/backend/sql_agents/agents/fixer/fixer_response_test.py
,src/tests/backend/sql_agents/agents/migrator/migrator_response_test.py
). [1] [2]SQLAgentFactory
class to validate agent creation and error handling for invalid agent types (src/tests/backend/sql_agents/agents/agent_factory_test.py
).Abstract Method Refinements
upload_file
,get_file
,delete_file
,list_files
) inblob_base.py
to include# pragma: no cover
to exclude them from coverage reports, as they are meant to be implemented by subclasses (src/backend/common/storage/blob_base.py
). [1] [2] [3] [4]# pragma: no cover
for theconvert_script
function inconvert_script.py
to exclude it from coverage since it serves as an entry point (src/backend/sql_agents/convert_script.py
).Test File Cleanup
sys.path
manipulation and# noqa
comments incosmosdb_test.py
, simplifying the test file structure (src/tests/backend/common/database/cosmosdb_test.py
).Does this introduce a breaking change?
Golden Path Validation
Deployment Validation
What to Check
Verify that the following are valid
Other Information